export function useShowLoading(returnArray=false) {
  const handleLoading = (config = {}) => {
    const showLoadingConfig = {
      title: '数据加载中',
      mask: true,
      ...config
    };
    uni.showLoading(showLoadingConfig);
  };

  const cancelLoading = (time = 200) => {
    setTimeout(() => {
      uni.hideLoading();
    }, time);
  };

  return returnArray ? [handleLoading, cancelLoading] : { handleLoading, cancelLoading };
}
